#pragma once
#include "Object.h"
#include "Information.h"
#include "Object.h"
#include <math.h>
#include <vector>
using std::vector;
class QuadNode
{
public:
	vector < Object* > listOfObject;
	RECT * _rect;
	QuadNode * _leftTop,*_leftButton,*_rightTop,*_rightButtom;
	QuadNode()
	{
		_rect = NULL;
		_leftButton = _leftTop = _rightButtom = _rightTop = NULL;
	}
	QuadNode(int left, int top, int width , int height)
	{
		_rect = new RECT();
		_rect->top = top;
		_rect->bottom = top + height;
		_rect->left = left;
		_rect->right = left + width;
		_leftButton = _leftTop = _rightButtom = _rightTop = NULL;
	}
};

class QuadTree
{
public:
	QuadNode * _root;
	int			_widthMap;
	int			_heightMap;
	QuadTree(int width, int height);
	void AddObj(QuadNode *root , Object *obj);
	void DrawObj(QuadNode *root);
	bool CheckCircleInCircle(Circle circle1 , Circle circle2);
	bool CheckRectInRect(RECT rect1, RECT rect2);
	bool CheckPointInRect(int x, int y, RECT rect);
	void CheckCollision(QuadNode *root, RECT rect,Circle circle, int Id,vector<Object*>result);
	void GetAllObjInRect(QuadNode *root ,RECT rect ,Circle circle , vector<Object *> result);
};